<template>
  <div>
    <van-divider content-position="left">mock测试</van-divider>
    <van-button @click="getUserInfo">get获取用户信息</van-button>
    <van-button @click="getUserList">post获取用户列表</van-button>
    <van-button @click="errorTest">请求错误，全局拦截</van-button>
    <div>
      用户信息：{{userInfo}}
    </div>
    <div>
      用户列表：{{userList}}
    </div>
    <p>全局过滤器当前时间：{{thisTime | timeFormat('yyyy-mm-dd hh:mm')}}</p>
    <van-button @click="$router.push('/t1/2')">权限测试-有权限</van-button>
    <van-button @click="$router.push('/t2')">权限测试-无权限</van-button>
  </div>
</template>

<script>
import {getUserListApi, getUserInfoApi, errorTestApi} from '@/http/api'
export default {
  name: 'personal',
  data () {
    return {
      userInfo: null,
      userList: [],
      thisTime: new Date().getTime()
    }
  },
  methods: {
    getUserList(){
      getUserListApi(30)
        .then(res => {
          console.log(res)
          this.userList = res.data.data
        })
    },
    getUserInfo(){
      getUserInfoApi()
        .then(res => {
          console.log(res)
          this.userInfo = res.data.data
        })
    },
    errorTest(){
      errorTestApi()
        .then(res => {
          console.log(res)
        })
    }
  }
}
</script>

<style scoped lang="less">

</style>
